// https://vitepress.dev/guide/custom-theme
import { h } from "vue";
import type { Theme } from "vitepress";
import DefaultTheme from "vitepress/theme";
import ElementPlus from "element-plus";
import LeisureLib from "leisure-lib";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import { AntDesignContainer } from "@vitepress-demo-preview/component";
import IconList from "../../views/components/icon/iconList.vue";
import "leisure-lib/dist/style/index.less";
import "element-plus/dist/index.css";
import "@vitepress-demo-preview/component/dist/style.css";
import "./style.css";

export default {
  extends: DefaultTheme,
  Layout: () => {
    return h(DefaultTheme.Layout, null, {
      // https://vitepress.dev/guide/extending-default-theme#layout-slots
    });
  },
  enhanceApp({ app, router, siteData }) {
    app.use(ElementPlus).use(LeisureLib);
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component);
    }
    app.component("demo-preview", AntDesignContainer);
    app.component("icon-list", IconList);
    globalThis.app = app;
  },
} satisfies Theme;
